﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using DataAccessComponents;
using BusinessLogicLayer;

namespace inzDesktop
{
    /// <summary>
    /// Interaction logic for windowListaTerminow.xaml
    /// </summary>
    public partial class windowListaTerminow : Window
    {
        public windowListaTerminow()
        {
            InitializeComponent();
        }

        public Termin Termin { get; set; }

        public void inicjalizujZawartosc(int idoferta)
        {
            TerminBL terminBL = new TerminBL();
            dataGridListaTerminow.ItemsSource = terminBL.pobierzListe(idoferta);
        }

        private void buttonSzczegoly_Click(object sender, RoutedEventArgs e)
        {
            windowSzczegolyTermin wst = new windowSzczegolyTermin();            
            Termin termin = dataGridListaTerminow.SelectedItem as Termin;
            wst.inicjalizujZawartosc(termin.Id_termin);
            wst.Show();
        }

        private void btnWybierz_Click(object sender, RoutedEventArgs e)
        {
            if (dataGridListaTerminow.SelectedItem != null)
            {
                this.Termin = dataGridListaTerminow.SelectedItem as Termin;
                DialogResult = true;
            }
        }

        private void btnAnuluj_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = false;
            
        }
    }
}
